<template>
  <div id="app">
    <Loading v-show="loading"></Loading>
    <router-view/>
  </div>
</template>
<script>
import Loading from "./components/common/Loading";
import { mapGetters } from "vuex";
export default {
  computed: {
    ...mapGetters(["loading"])
  },
  methods: {
    checkLogin() {
      try {
        let user = sessionStorage.getItem("user");
        user = JSON.parse(user);
        if (!user || !user.token) {
          this.$router.push("/login");
        }
      } catch (error) {
        console.log(error);
        this.$router.push("/login");
      }
    }
  },
  created() {
    this.checkLogin();
  },
  components: {
    Loading
  }
};
</script>
<style lang="scss">
html,
body,
#app {
  width: 100%;
  height: 100%;
}
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.el-dialog__body {
  padding: 25px 25px 0 !important;
}

.w-e-text-container {
  height: calc(100% - 31px) !important;
  background: #f0f0f0;
  .w-e-text {
    max-width: 780px;
    margin: 0 auto !important;
    overflow-y: hidden;
    background: #fff;
  }
}
</style>
